# coding=utf-8

import unittest
from common.order.db import get_order_overview

SUCCESS = 2
MANUAL_SUCCESS = 4
parsed_dct = {u'$orderby': u'-id', u'$page': 1, u'$size': 30}

class test_get_order(unittest.TestCase):
    def test_match_total_amounts(self):
        order = get_order_overview(parsed_dct)
        self.assertEqual(float(order[0]), float(26939.93))
        self.assertEqual(float(order[1]), float(26932.21))
        self.assertEqual(float(order[2]), float(3503.59))

    def test_notmatch_total_amounts(self):
        order = get_order_overview(parsed_dct)
        self.assertNotEqual(float(order[0]), float(10161.11))
        self.assertNotEqual(float(order[1]), float(10260.95))
        self.assertNotEqual(float(order[2]), float(213.28))

    def test_wrong_type_total_amounts(self):
        order = get_order_overview(parsed_dct)
        self.assertNotEqual(order[0], 'test')
        self.assertNotEqual(order[1], '123d')
        self.assertNotEqual(order[2], float('123'))

if __name__ == '__main__':
    unittest.main()
